﻿/*
#------------------------------------------------------------------------------
#-- View Name:		[dbo].[vwWH_IndexOverview_Details]
#-- Purpose:		Used to review the status of maintenance
#--	Last Update:	09/08/2014
#--					For a complete history - please review comments in Source Control
#------------------------------------------------------------------------------
*/
CREATE VIEW [dbo].[vwWH_IndexOverview_Details]
AS
SELECT		[ius_server_ssd_id],
			[ius_databaseid],
			[ius_tableid],
			[ius_indexid],
			[ius_type],
			SUBSTRING(CONVERT(varchar(10), [ius_sql_starttime], 112), 1, 6) log_month,
			MIN([ius_sql_starttime]) startdate,
			MAX([ius_sql_starttime]) enddate,
			SUM([ius_user_updates]) [ius_user_updates],
			SUM([ius_user_uses]) [ius_user_uses],
			SUM([ius_system_updates]) [ius_system_updates],
			SUM([ius_system_uses]) [ius_system_uses]
FROM		[dbo].[tblWH_IndexUsage]
GROUP BY	[ius_server_ssd_id],
			[ius_databaseid],
			[ius_tableid],
			[ius_indexid],
			[ius_type],
			SUBSTRING(CONVERT(varchar(10), [ius_sql_starttime], 112), 1, 6)
